Skip to content

Fix soft-deleted islands still counting towards a player's islands - #3086

Merged
tastybento merged 2 commits into
BentoBoxWorld:developfrom
daniel-skopek:fix/deleted-island-uuid-index
Sep 25, 2026
Merged

tastybento merged 2 commits into
BentoBoxWorld:developfrom
daniel-skopek:fix/deleted-island-uuid-index

Conversation

@daniel-skopek

Copy link
Copy Markdown
Contributor

Problem

When an island is deleted (island reset or /obadmin delete), BentoBox only
clears the owner. The island is still left in the in-memory per-player UUID
index (islandsByUUID) until the server restarts.

Because of that:

  • getNumberOfConcurrentIslands() keeps counting the deleted island, so an
    admin can't transfer an island to the ex-owner ("player already owns N
    islands").
  • getIslands(world, uuid) still returns the deleted island, but
    hasIsland() does not, so /obadmin delete says the player has no island.
  • /obadmin purge deleted doesn't help either: the DB row and cache entry
    are only removed on shutdown.

On startup this is not a problem because addIsland() only indexes owned
islands, which is why a restart "fixes" it.

Fix

Add IslandCache#removeIslandFromUUIDIndex() and call it from
IslandsManager#deleteIsland() right after the owner is cleared. The island
is removed from every player's index, but kept in islandsById and the grid
so its location stays reserved and the region purge can still reap it.

Tests

  • IslandCacheTest#testRemoveIslandFromUUIDIndex
  • IslandsManagerTest#testDeleteIslandRemovesIslandFromUUIDIndex

Deleting an island (reset or /obadmin delete) cleared its owner but left
it in the per-player UUID cache index. Until the next restart the island
still counted towards the ex-owner's concurrent islands and was returned
by getIslands(world, uuid). This blocked island transfers with the
"already owns N islands" error, even though /obadmin delete said the
player had no island.

Drop the island from the UUID index when it is soft-deleted. It stays
cached and in the grid so the region purge can still find and reap it.
@tastybento tastybento self-assigned this Sep 25, 2026
@tastybento
tastybento self-requested a review September 25, 2026 07:38
@tastybento
tastybento merged commit ff190b6 into BentoBoxWorld:develop Sep 25, 2026
1 check failed
@tastybento

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants